<!DOCTYPE html>
<body>
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<div id="log"></div>
<input type="search" incremental>
<script>
var input = document.querySelector('input');

var test = async_test('Changing the input type before dispatching a search event should not crash.');
test.step(function() {
    input.offsetTop;
    // Trigger 'search' event.
    var enterEvent = document.createEvent('TextEvent');
    enterEvent.initTextEvent('textInput', true, true, document.defaultView, '\n');
    input.dispatchEvent(enterEvent);
    // A 'search' event dispatching task was scheduled. Changing the input type
    // before the task is performed.
   input.type = 'text';
});
setTimeout(function() { test.step(function() {
    // No crash.
    test.done();
})}, 0);
</script>
</body>
